package com.neutech.controller;

import com.neutech.service.SchedulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
public class SchedulController {

    /*******************排班___START*************************/
    @Autowired
    private SchedulService schedulService;
    @RequestMapping("/querySchedul")
    public List<Map<String,Object>> getSchedul(){
        return schedulService.querySchedul();
    }
    @RequestMapping("/insertSchedul")
    public void insSchedul(@RequestParam Map  map){
        //System.out.println("看这里！");
        //System.out.println(map);
        schedulService.insertSchedul(map);
    }
    @RequestMapping("/deleteSchedul")
    public void delSchedul(@RequestParam Map  map){
        schedulService.deleteSchedul(map);
        //System.out.println(map.get("depid"));
    }
    @RequestMapping("/updataSchedul")
    public void updSchedul(@RequestParam Map  map){
        System.out.println("看这里");
        System.out.println(map);
        System.out.println("看这里");
        Map<String,Object> map2 = new HashMap<>();
        map2.put("schid",map.get("schid"));
        map2.put("docid",map.get("docid"));
        map2.put("depid",map.get("depid"));
        map2.put("depname",map.get("depname"));
        map2.put("docname",map.get("docname"));
        map2.put("monday",map.get("monday"));
        map2.put("tuesday",map.get("tuesday"));
        map2.put("wednesday",map.get("wednesday"));
        map2.put("thursday",map.get("thursday"));
        map2.put("friday",map.get("friday"));
        map2.put("saturday",map.get("saturday"));
        map2.put("sunday",map.get("sunday"));
        System.out.println(map2);
        schedulService.updataSchedul(map2);
    }
    /**************************END*******************************/
}
